package com.iraeta.controller;

import com.iraeta.service.basic.KaoQinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component
@EnableScheduling
@EnableAsync
public class GlobalTask {
    private static final Logger logger = LoggerFactory.getLogger(GlobalTask.class);

    @Autowired
    KaoQinService kaoQinService;

    @Scheduled(cron = "0 40 7,9 * * ?")
    @Async("cstaskexecutor")
    public void processWeiXinKaoQinEveryDay() {
        logger.info("processWeiXinKaoQinEveryDay begin");
        try {
            kaoQinService.processWeiXinKaoQinEveryDay();         //同步日考勤
        }catch (Exception e){
            logger.error("日考勤同步:" + e.getMessage());
        }
        logger.info("processWeiXinKaoQinEveryDay end");
    }
}
